/*
 * @Description: 系统配置接口
 * @Author: liks
 * @Date: 2025-01-06 16:39:10
 * @LastEditors: liks
 * @LastEditTime: 2025-01-06 17:25:37
 */
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { SystemService } from './system.service';
import { CreateSystemDto } from './dto/create-system.dto';
import { UpdateSystemDto } from './dto/update-system.dto';
import { ApiOperation, ApiTags } from '@nestjs/swagger';

@ApiTags('系统数据管理')
@Controller('system')
export class SystemController {
  constructor(private readonly systemService: SystemService) {}

  @ApiOperation({ summary: '初始化系统数据' })
  @Post()
  create(@Body() createSystemDto: CreateSystemDto) {
    return this.systemService.create(createSystemDto);
  }

  @ApiOperation({ summary: '获取系统参数列表' })
  @Get()
  findAll() {
    return this.systemService.findAll();
  }

  @ApiOperation({ summary: '获取系统详情数据' })
  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.systemService.findOne(id);
  }

  @ApiOperation({ summary: '更新系统数据' })
  @Patch(':id')
  update(@Param('id') id: string, @Body() updateSystemDto: UpdateSystemDto) {
    return this.systemService.update(id, updateSystemDto);
  }

  @ApiOperation({ summary: '删除系统数据' })
  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.systemService.remove(id);
  }

  @ApiOperation({ summary: '获取系统详情数据' })
  @Get('/detail')
  getSystemData() {
    return this.systemService.getSystemData()
  }

  @ApiOperation({ summary: '系统浏览量+1' })
  @Patch('/pageView')
  pagView() {
    return this.systemService.incrementPageView()
  }
}
